package com.neborosoft.lib.collections.map;

import org.apache.commons.collections15.MultiMap;
import org.apache.commons.collections15.multimap.MultiHashMap;

import java.util.Collection;
import java.util.HashSet;
import java.util.Map;

/**
 * Project: FlyingDog
 * User: stikhonenko
 * Date: 3/5/13
 * Time: 7:52 PM
 */
public class UniqueValuesMultiHashMap<K,V> extends MultiHashMap<K,V>{
    public UniqueValuesMultiHashMap() {
    }

    public UniqueValuesMultiHashMap(int initialCapacity) {
        super(initialCapacity);
    }

    public UniqueValuesMultiHashMap(int initialCapacity, float loadFactor) {
        super(initialCapacity, loadFactor);
    }

    public UniqueValuesMultiHashMap(Map<K, V> mapToCopy) {
        super(mapToCopy);
    }

    public UniqueValuesMultiHashMap(MultiMap<K, V> mapToCopy) {
        super(mapToCopy);
    }

    @Override
    protected Collection<V> createCollection(Collection<? extends V> coll) {
        if(coll == null){
            return new HashSet<V>();
        } else {
            return new HashSet<V>(coll);
        }
    }
}
